
BeijingManager = {};
local this = BeijingManager;

local gameObject;
local transform;

function BeijingManager.New()
	resMgr:LoadPrefab("prefabs", {"Beijing"}, this.OnLoadOK);
end

function BeijingManager.OnLoadOK(objs)
	gameObject = newObject(objs[0]);
	transform = gameObject.transform;
	transform.position = Vector3(0,0,10);
	
	this.beijing = transform:Find("beijing"):GetComponent('MeshRenderer').material;
	this.center = transform:Find("center"):GetComponent('MeshRenderer').material;
	this.front = transform:Find("front"):GetComponent('MeshRenderer').material;
	
	UpdateBeat:Add(this.Update);
end

function BeijingManager.Update()
	this.Scroll(this.beijing, 0.1);
	this.Scroll(this.center, 0.2);
	this.Scroll(this.front, 0.3);
end

function BeijingManager.Scroll(mat, speed)
	mat.mainTextureOffset = mat.mainTextureOffset + Vector2.up * speed * Time.deltaTime;
end 